package com.zygh.policeasset.mapper;

import com.zygh.policeasset.pojo.DailyAsset;
import com.zygh.policeasset.pojo.export.ExportBasics;
import java.util.List;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Options;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Result;
import org.apache.ibatis.annotations.ResultMap;
import org.apache.ibatis.annotations.Results;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import org.apache.ibatis.type.JdbcType;

@Mapper
/* loaded from: police-asset-2.0-0.0.1-SNAPSHOT.jar:BOOT-INF/classes/com/zygh/policeasset/mapper/DailyAssetMapper.class */
public interface DailyAssetMapper {
    @Delete({"delete from daily_asset   where id = #{id,jdbcType=INTEGER}"})
    int deleteById(Integer num);

    @Delete({"delete from daily_asset  where build_num = #{buildNum,jdbcType=INTEGER}"})
    int deleteBybuildNum(String str);

    @Insert({"insert into daily_asset (asset_num,build_num, pact_name, ", "big_num, small_num, basics_name, specifica, ", "brand, number, start_money,money, construc_unit, ", "build_unit, start_time,stop_time,  plan_year,place, remark, ", "create_time,user_id,data_labels_id)", "values (#{assetNum,jdbcType=INTEGER}, #{buildNum,jdbcType=VARCHAR}, #{pactName,jdbcType=VARCHAR}, ", "#{bigNum,jdbcType=VARCHAR}, #{smallNum,jdbcType=VARCHAR}, ", "#{basicsName,jdbcType=VARCHAR}, #{specifica,jdbcType=VARCHAR}, ", "#{brand,jdbcType=VARCHAR}, #{number,jdbcType=INTEGER}, #{startMoney,jdbcType=VARCHAR},", "#{money,jdbcType=VARCHAR}, #{construcUnit,jdbcType=VARCHAR}, ", "#{buildUnit,jdbcType=VARCHAR}, #{startTime,jdbcType=VARCHAR},#{stopTime,jdbcType=VARCHAR}, ", "#{planYear,jdbcType=INTEGER}, #{place,jdbcType=VARCHAR}, #{remark,jdbcType=VARCHAR}, ", "#{createTime,jdbcType=VARCHAR}, #{userId,jdbcType=INTEGER}, #{dataLabelsId,jdbcType=INTEGER})"})
    @Options(useGeneratedKeys = true, keyProperty = "id", keyColumn = "id")
    int add(DailyAsset dailyAsset);

    @Update({"update daily_asset set asset_num = #{assetNum,jdbcType=INTEGER},", "build_num = #{buildNum,jdbcType=VARCHAR},", "pact_name = #{pactName,jdbcType=VARCHAR},", "big_num = #{bigNum,jdbcType=VARCHAR},", "small_num = #{smallNum,jdbcType=VARCHAR},", "basics_name = #{basicsName,jdbcType=VARCHAR},", "specifica = #{specifica,jdbcType=VARCHAR},", "brand = #{brand,jdbcType=VARCHAR},", "number = #{number,jdbcType=INTEGER},", "start_money = #{startMoney,jdbcType=VARCHAR},", "money = #{money,jdbcType=VARCHAR},", "construc_unit = #{construcUnit,jdbcType=VARCHAR},", "build_unit = #{buildUnit,jdbcType=VARCHAR},", "start_time = #{startTime,jdbcType=VARCHAR},", "plan_year = #{planYear,jdbcType=INTEGER},", "place = #{place,jdbcType=VARCHAR},", "remark = #{remark,jdbcType=VARCHAR},", "create_time = #{createTime,jdbcType=VARCHAR}", "where id = #{id,jdbcType=INTEGER}"})
    int update(DailyAsset dailyAsset);

    @Select({"<script>SELECT d.*,w.`witbig_name`,wi.`witsmall_name`,c.`unit_name`,c1.`unit_name` AS construc_name,ac1.`name` AS assetsClassificationPName,ac.`name` AS assetsClassificationName from daily_asset  d LEFT JOIN witbig w ON d.`big_num` = w.`witbig_num` AND w.`type`= #{category} LEFT JOIN witsmall wi ON d.`small_num` = wi.`witsmall_num` AND wi.`type`= #{category}  AND d.`big_num` = wi.`witbig_num`  LEFT JOIN unit c ON d.`build_unit`= c.`unit_num` AND c.`type`= #{category} LEFT JOIN unit c1 ON d.`construc_unit`= c1.`unit_num` AND c1.`type`='zd'  LEFT JOIN  assets_id_type t8 ON d.id = t8.asset_id AND  t8.asset_type = 'da' LEFT JOIN assets_approval_steps t7 ON t7.steps_id = t8.steps_id AND t7.steps_type = 'da' LEFT JOIN assets_classification ac1 ON d.assets_classification_pid=ac1.id LEFT JOIN assets_classification ac ON d.assets_classification_id=ac.id <where> <if test='dailyProjectId != null'> and d.build_num = #{dailyProjectId} </if><if test='basicsName != null and basicsName.length &gt; 0'> and d.basics_name = #{basicsName} </if><if test='assetsClassificationId == 0'> AND d.assets_classification_id IS  NULL </if><if test='assetsClassificationId == 1'> AND d.assets_classification_id IS NOT NULL </if></where></script>"})
    @Results(id = "dailyassetMap", value = {@Result(column = "id", property = "id", jdbcType = JdbcType.INTEGER, id = true), @Result(column = "asset_num", property = "assetNum", jdbcType = JdbcType.VARCHAR), @Result(column = "build_num", property = "buildNum", jdbcType = JdbcType.VARCHAR), @Result(column = "pact_name", property = "pactName", jdbcType = JdbcType.VARCHAR), @Result(column = "big_num", property = "bigNum", jdbcType = JdbcType.VARCHAR), @Result(column = "small_num", property = "smallNum", jdbcType = JdbcType.VARCHAR), @Result(column = "basics_name", property = "basicsName", jdbcType = JdbcType.VARCHAR), @Result(column = "specifica", property = "specifica", jdbcType = JdbcType.VARCHAR), @Result(column = "brand", property = "brand", jdbcType = JdbcType.VARCHAR), @Result(column = "number", property = "number", jdbcType = JdbcType.VARCHAR), @Result(column = "start_money", property = "startMoney", jdbcType = JdbcType.VARCHAR), @Result(column = "money", property = "money", jdbcType = JdbcType.VARCHAR), @Result(column = "construc_unit", property = "construcUnit", jdbcType = JdbcType.VARCHAR), @Result(column = "construc_name", property = "construc_name", jdbcType = JdbcType.VARCHAR), @Result(column = "build_unit", property = "buildUnit", jdbcType = JdbcType.VARCHAR), @Result(column = "start_time", property = "startTime", jdbcType = JdbcType.VARCHAR), @Result(column = "stop_time", property = "stopTime", jdbcType = JdbcType.VARCHAR), @Result(column = "plan_year", property = "planYear", jdbcType = JdbcType.VARCHAR), @Result(column = "place", property = "place", jdbcType = JdbcType.VARCHAR), @Result(column = "remark", property = "remark", jdbcType = JdbcType.VARCHAR), @Result(column = "create_time", property = "createTime", jdbcType = JdbcType.VARCHAR), @Result(column = "user_id", property = "userId", jdbcType = JdbcType.INTEGER), @Result(column = "witbig_name", property = "witbig_name", jdbcType = JdbcType.VARCHAR), @Result(column = "witsmall_name", property = "witsmall_name", jdbcType = JdbcType.VARCHAR), @Result(column = "unit_name", property = "unit_name", jdbcType = JdbcType.VARCHAR), @Result(column = "start_provision_date", property = "startProvisionDate", jdbcType = JdbcType.VARCHAR), @Result(column = "assets_classification_id", property = "assetsClassificationId", jdbcType = JdbcType.INTEGER), @Result(column = "assets_classification_pid", property = "assetsClassificationPid", jdbcType = JdbcType.INTEGER), @Result(column = "data_labels_id", property = "dataLabelsId", jdbcType = JdbcType.INTEGER)})
    List<DailyAsset> findBydailyProjectId(@Param("dailyProjectId") Integer num, @Param("category") String str, @Param("basicsName") String str2, @Param("assetsClassificationId") Integer num2);

    @Select({"select * from daily_asset where build_num= #{buildNum}"})
    @ResultMap({"dailyassetMap"})
    List<DailyAsset> findAllBybuildNum(String str);

    @Select({"SELECT d.id,d.asset_num,d.pact_name,wb.witbig_name AS witbig_name,ws.witsmall_name AS witsmall_name,d.basics_name,d.specifica,d.brand,d.number,d.start_money,d.money,t4.unit_name AS construc_unit,\nt3.unit_name AS build_unit,d.start_time,d.stop_time,d.plan_year,d.place,d.remark FROM `daily_asset` d LEFT JOIN `daily_project` dp ON d.build_num = dp.id  LEFT JOIN `witbig` wb ON d.big_num = wb.witbig_num AND dp.category = wb.type LEFT JOIN `witsmall` ws ON d.small_num = ws.witsmall_num AND dp.category = ws.type  AND d.big_num = ws.witbig_num LEFT JOIN (SELECT * FROM unit ) t3 ON d.build_unit = t3.unit_num AND t3.type=dp.category LEFT JOIN (SELECT * FROM unit WHERE TYPE='zd') t4 ON d.construc_unit= t4.unit_num  WHERE  dp.id= #{buildNum}"})
    @Results({@Result(column = "id", property = "id", jdbcType = JdbcType.INTEGER, id = true), @Result(column = "asset_num", property = "assetNum", jdbcType = JdbcType.VARCHAR), @Result(column = "pact_name", property = "pactName", jdbcType = JdbcType.VARCHAR), @Result(column = "witbig_name", property = "witbigName", jdbcType = JdbcType.VARCHAR), @Result(column = "witsmall_name", property = "witsmallName", jdbcType = JdbcType.VARCHAR), @Result(column = "basics_name", property = "basicsName", jdbcType = JdbcType.VARCHAR), @Result(column = "start_money", property = "startMoney", jdbcType = JdbcType.VARCHAR), @Result(column = "construc_unit", property = "construcName", jdbcType = JdbcType.VARCHAR), @Result(column = "build_unit", property = "buildName", jdbcType = JdbcType.VARCHAR), @Result(column = "start_time", property = "startTime", jdbcType = JdbcType.VARCHAR), @Result(column = "stop_time", property = "stopTime", jdbcType = JdbcType.VARCHAR), @Result(column = "money", property = "money", jdbcType = JdbcType.VARCHAR), @Result(column = "plan_year", property = "planYear", jdbcType = JdbcType.VARCHAR), @Result(column = "place", property = "place", jdbcType = JdbcType.VARCHAR), @Result(column = "remark", property = "remark", jdbcType = JdbcType.VARCHAR)})
    List<ExportBasics> exportExcel(String str);

    @Select({"select * from daily_asset where id= #{id}"})
    @ResultMap({"dailyassetMap"})
    DailyAsset findAllByid(Integer num);

    @Update({"update daily_asset set start_provision_date=#{startProvisionDate} where build_num = #{id}"})
    Integer updateStartProvisionDate(@Param("startProvisionDate") String str, @Param("id") Integer num);

    @Update({"update daily_asset set assets_classification_id=#{assetsClassificationId},assets_classification_pid = #{assetsClassificationPid}  where id = #{id} "})
    Integer updateassetsClassification(@Param("id") Integer num, @Param("assetsClassificationId") Integer num2, @Param("assetsClassificationPid") Integer num3);

    @Select({"select count(*) from daily_asset  where build_num = #{id} "})
    Integer findByBuildNum(@Param("id") Integer num);

    @Select({"SELECT d.*,dp.category FROM daily_asset d LEFT JOIN `daily_project` dp ON d.build_num = dp.id  "})
    @ResultMap({"dailyassetMap"})
    List<DailyAsset> findAll();
}